git remote のパース
以下のような入力がありうる
git@github.com:pokutuna/Pokupoku.git
https://ghe.private.host/pokutuna/Pokupoku.git
code:parse-remote.pl
my ($base, $owner, $repo) = do {
my $origin = git remote get-url origin;
chomp $origin;
my $base = do {
my $r = $origin;
$r =~ s|.*://||;
$r =~ s|.*@||;
$r =~ s|/.*$||;
$r =~ s|:.*||;
};
my ($owner, $repo) = do {
my $r = $origin;
$r =~ s|.git$||;
$r =~ s|.*:||;
split '/', $r;
};
($base, $owner, $repo);
};